package com.epoint.flinkdemo.transform;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author liufl
 * @version [版本号, 21-4-2]
 */
public class MapTest
{

    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        System.out.println("默认并行度=====>" + env.getParallelism());
        String[] words = {"apple","orange","banana","watermelon"};

        // 创建DataSource
        DataStreamSource<String> streamSource = env.fromElements(words);

        // 将所有字符全部转成大写
        DataStream<String> upStream = streamSource.map(item -> {
            return item.toUpperCase();
        });

        upStream.print();

        env.execute();
    }
}
